package com.woniu.controller;

import com.woniu.entity.Bed;
import com.woniu.entity.Ward;
import com.woniu.service.BedService;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/bed")
public class BedController {
    @Resource
    private BedService bedService;

    @GetMapping("/findAll")
    public ResponseUtil selectAll(@RequestParam Integer pageNum, @RequestParam Integer pageSize){
        return bedService.findAll(pageNum,pageSize);
    }
    @PostMapping("/update")
    public ResponseUtil updateByPrimaryKeySelective(@RequestBody Bed record){
        return bedService.updateByPrimaryKeySelective(record);
    }

    @PostMapping("/del")
    public ResponseUtil updateBed(Integer id){
        return bedService.updateBed(id);
    }
    @PostMapping("/insert")
    public ResponseUtil insertSelective(@RequestBody Bed record){
        return bedService.insertSelective(record);
    }
    @GetMapping("/findWardId")
    public ResponseUtil findByWardId(@RequestParam Integer wardId,@RequestParam Integer pageNum, @RequestParam Integer pageSize){
        return bedService.findByWardId(wardId,pageNum,pageSize);
    }
}
